#include "../Card.h"
#include "../Player.h"
#include "../Table.h"
#include "../Deck.h"
#include "../Advisor.h"
#include <assert.h>
#include <vector>
#include<iostream>

#define VERBOSE 1

using namespace std;
int main(){

#if VERBOSE
  cout<<"Creating four Mock Players"<<endl;
#endif

//INSTANTIATING PLAYERS AND SETTING TO AI
	//Create a few players and have two of them as AI
	Table t = Table(4);
	Player p1 = t.players.at(0);
	Player p2 = t.players.at(1);
	Player p3 = t.players.at(2);
	Player p4 = t.players.at(3);

	//set p3 and p4 to Ai
	#if VERBOSE
	  cout<<"Setting two of them to AI opponents"<<endl;
	#endif
	Advisor* CzarInstructor;
	p3.setAdvisor(CzarInstructor);
	p4.setAdvisor(CzarInstructor);

//FEEDING THE VASSAL TESTS


	//set p2 as p1's vassal
	#if VERBOSE
	  cout<<"p2 is now p1's vassal"<<endl;
	#endif
	p1.addVassal(&p2);
	p2.setOwner(&p1);
	assert(p1.getVassals().at(0) == &p2);
	assert(p2.getOwner() == &p1);
	assert(p2.getIsVassal());
	//TEST 1
		#if VERBOSE
		  cout<<"player 1 before giving cards: ";
		  cout<<p1.getArmy()->size()<<endl;
		  cout<<"player 2 before recieving cards: ";
		  cout<<p1.getArmy()->size()<<endl;
		#endif
		//p1 will now feed p2 10 cards using FeedAllVassals
		p1.setMoveFeed(10);
		p1.feedAllVassals();
		#if VERBOSE
		  cout<<"player 1 after giving cards: ";
		  cout<<p1.getArmy()->size()<<endl;
		  cout<<"player 2 after receiving cards: ";
		  cout<<p2.getArmy()->size()<<endl;
		#endif
		assert(p1.getArmy()->size() == 14);
		assert(p2.getArmy()->size() == 34);

	//TEST 2
		//p1 will now give the rest of his cards
		#if VERBOSE
		  cout<<"player 1 before all cards: ";
		  cout<<p1.getArmy()->size()<<endl;
		  cout<<"player 2 before all cards: ";
		  cout<<p2.getArmy()->size()<<endl;
		#endif
		//p1 will now feed p2 all cards
		p1.feedVassal(&p2, p1.getArmy()->size());
		#if VERBOSE
		  cout<<"player 1 after all cards: ";
		  cout<<p1.getArmy()->size()<<endl;
		  cout<<"player 2 after all cards: ";
		  cout<<p2.getArmy()->size()<<endl;
		#endif
		assert(p1.getArmy()->size() == 0);
		assert(p2.getArmy()->size() == 48);

	//TEST 3
		//p1 will now attempt to give cards he doesnt have
		#if VERBOSE
		  cout<<"player 1 before giving non existing cards: ";
		  cout<<p1.getArmy()->size()<<endl;
		  cout<<"player 2 before recieving non existing cards: ";
		  cout<<p2.getArmy()->size()<<endl;
		#endif
		//p1 will now feed p2 all cards
		p1.setMoveFeed(10);
		p1.feedVassal(&p2, p1.getFeedNumber());
		#if VERBOSE
		  cout<<"player 1 after giving non existent cards: ";
		  cout<<p1.getArmy()->size()<<endl;
		  cout<<"player 2 after receiving non existent cards: ";
		  cout<<p2.getArmy()->size()<<endl;
		#endif
		//no cards should be transfered from previous test
		assert(p1.getArmy()->size() == 0);
		assert(p2.getArmy()->size() == 48);

//TESTING WAR FLAG
	p1.setWarFlag(true);
	#if VERBOSE
	  if(p1.getWarFlag()){ cout<< "p1 is at war! test succeeded!" <<endl;}
	  if(!p1.getWarFlag()){ cout<< "p1 is not at war! test FAILED!" <<endl;}
	#endif
 	assert(p1.getWarFlag());


//TESTING FOR ADDRESS
	p1.setAddress("BANANA");
	#if VERBOSE
	 cout<< " <<endl;
	 cout<< p1.getAddress() <<endl;
	#endif
	assert(p1.getAddress() == "BANANA");

  
    //Functional
   
    //void feedAllVassals();
    
   // void refillHand();
    

   /*
    Deck* getHand();
    
    int getMaxHandSize();
   
    vector<Player*> getFeedVassal();
    Card* getMoveCard();
   
    //Sets
   

    //Descriptive
    //int playerNumber;//mightnot be necessary

    //trash can:
    //int getHandCount(); we can just use "getHand()->size()"
    //int getMoveFeed();
 
  private:
    Advisor* ai;
    vector<Player*> vassals;
    Player* owner;
    vector<Player*> moveFeedVassals;
    Deck hand;
    Deck army;
    Card* moveCard;
    string address;
    int moveFeedNumber;
    int maxHandSize;
    bool dead;
    bool warFlag;
*/
return 0;
}
